package com.yumeng.framework.auth.shiro;


import org.apache.shiro.SecurityUtils;
import org.apache.shiro.cache.CacheManager;
import org.apache.shiro.mgt.CachingSecurityManager;
import org.apache.shiro.mgt.SecurityManager;

/**
 * @author wxd
 * @date 2022/5/9 20:46
 */
public class ShiroUtils {

    /**
     * 获取缓存管理器
     *
     * @return
     */
    public static CacheManager getCacheManager(){
        SecurityManager securityManager = SecurityUtils.getSecurityManager();
        if (securityManager instanceof CachingSecurityManager){
            return ((CachingSecurityManager) securityManager).getCacheManager();
        }
        return null;
    }

}
